<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace app\xwam\model;

/**
 * Description of MenuModel
 *
 * @author SoChishun
 */
class MenuModel {

    // 2017-4-1
    public static function getMemberMenus() {
        $data = array(
            array('name' => 'mall', 'text' => '卖家', 'icon' => 'fa-balance-scale', 'children' => array(
                    array('name' => 'order', 'text' => '订单管理', 'url' => 'Order/index'),
                    array('name' => 'product', 'text' => '商品管理', 'url' => 'ProductGoods/index'),
                    array('name' => 'product-category', 'text' => '商品分类', 'url' => 'ProductCategory/index'),
                    array('name' => 'promotion', 'text' => '促销活动', 'url' => 'ProductPromotion/index'),
                    array('name' => 'reviews', 'text' => '评论管理', 'url' => 'ProductReply/index'),
                    array('name' => 'settings', 'text' => '店铺设置', 'url' => 'MallSettings/edit'),
                    array('name' => 'index', 'text' => '网站会员'),
                    array('name' => 'links', 'text' => '友情链接', 'url' => 'Links/index'),
                )),
            array('name' => 'mall', 'text' => '交易', 'icon' => 'fa-shopping-bag', 'children' => array(
                    array('name' => 'order', 'text' => '紫薯商城', 'url' => 'Order/index'),
                    array('name' => 'product', 'text' => '我的购物车', 'url' => 'ProductGoods/index'),
                    array('name' => 'product-category', 'text' => '我的订单', 'url' => 'ProductCategory/index'),
                    array('name' => 'promotion', 'text' => '已购商品', 'url' => 'ProductPromotion/index'),
                    array('name' => 'reviews', 'text' => '评论管理', 'url' => 'ProductReply/index'),
                    array('name' => 'settings', 'text' => '我的优惠券', 'url' => 'MallSettings/edit'),
                    array('name' => 'settings', 'text' => '充值/续费', 'url' => 'MallSettings/edit'),
                    array('name' => 'settings', 'text' => '消费统计', 'url' => 'MallSettings/edit'),
                )),
            array('name' => 'content', 'text' => '内容', 'icon' => 'fa-file-text', 'children' => array(
                    array('name' => 'article', 'text' => '文章管理', 'url' => 'Article/index'),
                    array('name' => 'article-category', 'text' => '文章类别', 'url' => 'ArticleCategory/index'),
                    array('name' => 'advert', 'text' => '广告管理', 'url' => 'Advert/index'),
                    array('name' => 'navigation', 'text' => '导航菜单', 'url' => 'WebsiteMenu/index'),
                    array('name' => 'reviews', 'text' => '评论管理', 'url' => 'ContentReply/index'),
                )),
            array('name' => 'security', 'text' => '安全', 'icon' => 'fa-shield', 'children' => array(
                    array('name' => 'security-settings', 'text' => '安全认证'),
                    array('name' => 'blacklist', 'text' => '黑名单管理', 'url' => 'Blacklist/index'),
                    array('name' => 'log', 'text' => '日志记录', 'url' => 'LoginLog/index'),
                )),
        );
        return $data;
    }

    /**
     * 
     * @param type $pid
     * @return array
     * @version 2018-4-16
     */
    public static function getMenus($pid = '') {
        $menus = [
            /**/
            '101200300' => ['id' => '101200300', 'text' => '用户', 'url' => '', 'icon' => '', 'children' => [
                    '101201300' => ['id' => '101201300', 'text' => '用户管理', 'url' => '', 'icon' => 'fa-user', 'children' => [
                            '101201301' => ['id' => '101201301', 'text' => '主播列表', 'url' => '', 'icon' => ''],
                            '101201302' => ['id' => '101201302', 'text' => '会员列表', 'url' => '', 'icon' => ''],
                            '101201303' => ['id' => '101201303', 'text' => '机器人列表', 'url' => '', 'icon' => ''],
                            '101201304' => ['id' => '101201304', 'text' => '机器人配置', 'url' => '', 'icon' => ''],
                            '101201305' => ['id' => '101201305', 'text' => '用户注册配置', 'url' => '', 'icon' => ''],
                            '101201306' => ['id' => '101201306', 'text' => '用户登录配置', 'url' => '', 'icon' => ''],
                        ]],
                    '101202300' => ['id' => '101202300', 'text' => '管理员管理', 'url' => '', 'icon' => 'fa-user-secret', 'children' => [
                            '101202301' => ['id' => '101202301', 'text' => '管理员列表', 'url' => url('user.admin/index'), 'icon' => ''],
                        ]],
                ]],
            /**/
            '102200300' => ['id' => '102200300', 'text' => '直播', 'url' => '', 'icon' => '', 'children' => [
                    '102201300' => ['id' => '102201300', 'text' => '直播管理', 'url' => '', 'icon' => 'fa-video-camera', 'children' => [
                            '102201301' => ['id' => '102201301', 'text' => '直播中的视频', 'url' => '', 'icon' => ''],
                            '102201302' => ['id' => '102201302', 'text' => '直播结束的视频', 'url' => '', 'icon' => ''],
                            '102201303' => ['id' => '102201303', 'text' => '回播列表', 'url' => '', 'icon' => ''],
                            '102201304' => ['id' => '102201304', 'text' => '举报视频', 'url' => '', 'icon' => ''],
                            '102201305' => ['id' => '102201305', 'text' => '举报配置', 'url' => '', 'icon' => ''],
                            '102201306' => ['id' => '102201306', 'text' => '直播配置', 'url' => '', 'icon' => ''],
                        ]],
                ]],
            /**/
            '103200300' => ['id' => '103200300', 'text' => '内容', 'url' => '', 'icon' => '', 'children' => [
                    '103201300' => ['id' => '103201300', 'text' => '文章管理', 'url' => '', 'icon' => 'fa-file-text', 'children' => [
                            '103201301' => ['id' => '103201301', 'text' => '公告列表', 'url' => '', 'icon' => ''],
                            '103201302' => ['id' => '103201302', 'text' => '文章列表', 'url' => '', 'icon' => ''],
                            '103201303' => ['id' => '103201303', 'text' => '文章类别', 'url' => '', 'icon' => ''],
                        ]],
                ]],
            /**/
            '104200300' => ['id' => '104200300', 'text' => '推广', 'url' => '', 'icon' => '', 'children' => [
                    '104201300' => ['id' => '104201300', 'text' => '推广管理', 'url' => '', 'icon' => 'fa-pie-chart', 'children' => [
                            '104201301' => ['id' => '104201301', 'text' => '推广列表', 'url' => '', 'icon' => ''],
                            '104201302' => ['id' => '104201302', 'text' => '推广配置', 'url' => '', 'icon' => ''],
                        ]],
                    '104202300' => ['id' => '104202300', 'text' => '短信管理', 'url' => '', 'icon' => 'fa-mobile-phone', 'children' => [
                            '104202301' => ['id' => '104202301', 'text' => '短信任务列表', 'url' => url('sms.smstask/index'), 'icon' => ''],
                            '104202302' => ['id' => '104202302', 'text' => '短信明细列表', 'url' => url('sms.smsdetail/index'), 'icon' => ''],
                            '104202303' => ['id' => '104202303', 'text' => '短信服务器列表', 'url' => url('sms.smsserver/index'), 'icon' => ''],
                        ]],
                    '104203300' => ['id' => '104203300', 'text' => '邮件管理', 'url' => '', 'icon' => 'fa-mail-reply', 'children' => [
                            '104203301' => ['id' => '104203301', 'text' => '邮件任务列表', 'url' => url('email.emailtask/index'), 'icon' => ''],
                            '104203302' => ['id' => '104203302', 'text' => '邮件明细列表', 'url' => url('email.emaildetail/index'), 'icon' => ''],
                            '104203303' => ['id' => '104203303', 'text' => '邮件服务器列表', 'url' => url('email.emailserver/index'), 'icon' => ''],
                        ]],
                ]],
            /**/
            '105200300' => ['id' => '105200300', 'text' => '财务', 'url' => '', 'icon' => '', 'children' => [
                    '105201300' => ['id' => '105201300', 'text' => '提现管理', 'url' => '', 'icon' => '', 'children' => [
                            '105201301' => ['id' => '105201301', 'text' => '提现申请列表', 'url' => '', 'icon' => ''],
                            '105201302' => ['id' => '105201302', 'text' => '提现审核列表', 'url' => '', 'icon' => ''],
                            '105201303' => ['id' => '105201303', 'text' => '提现历史记录', 'url' => '', 'icon' => ''],
                        ]],
                    '105202300' => ['id' => '105202300', 'text' => '充值管理', 'url' => '', 'icon' => '', 'children' => [
                            '105202301' => ['id' => '105202301', 'text' => '充值列表', 'url' => '', 'icon' => ''],
                            '105202302' => ['id' => '105202302', 'text' => '充值历史记录', 'url' => '', 'icon' => ''],
                        ]],
                ]],
            /**/
            '106200300' => ['id' => '106200300', 'text' => '系统', 'url' => '', 'icon' => '', 'children' => [
                    '106201300' => ['id' => '106201300', 'text' => '系统配置', 'url' => '', 'icon' => 'fa-gear', 'children' => [
                            '106201301' => ['id' => '106201301', 'text' => '基础配置', 'url' => url('systemconf/index'), 'icon' => ''],
                            '106201302' => ['id' => '106201302', 'text' => '短信配置', 'url' => '', 'icon' => ''],
                            '106201303' => ['id' => '106201303', 'text' => '邮件配置', 'url' => '', 'icon' => ''],
                            '106201304' => ['id' => '106201304', 'text' => '直播配置', 'url' => '', 'icon' => ''],
                            '106201304' => ['id' => '106201304', 'text' => '敏感词设置', 'url' => url('SensitiveWords/content'), 'icon' => ''],
                            '106201304' => ['id' => '106201304', 'text' => '用户反馈', 'url' => url('feedback/index'), 'icon' => ''],
                        ]],
                    '106202300' => ['id' => '106202300', 'text' => '云服务配置', 'url' => '', 'icon' => 'fa-cloud', 'children' => [
                            '106202301' => ['id' => '106202301', 'text' => '腾讯云配置', 'url' => '', 'icon' => ''],
                            '106202302' => ['id' => '106202302', 'text' => '阿里云配置', 'url' => '', 'icon' => ''],
                        ]],
                    '106203300' => ['id' => '106203300', 'text' => '访问配置', 'url' => '', 'icon' => 'fa-internet-explorer', 'children' => [
                            '106203301' => ['id' => '106203301', 'text' => '帐号黑名单', 'url' => '', 'icon' => ''],
                            '106203302' => ['id' => '106203302', 'text' => 'IP黑名单', 'url' => '', 'icon' => ''],
                        ]],
                    '106204300' => ['id' => '106204300', 'text' => '日志管理', 'url' => '', 'icon' => '', 'children' => [
                            '106204301' => ['id' => '106204301', 'text' => '登录日志', 'url' => '', 'icon' => ''],
                        ]],
                ]],
        ];
        return $menus;
    }

    // 2018-1-31 for taocode
    public static function getMenusOfTaocode() {
        $data = array(
            array('name' => 'soft', 'text' => '软件', 'icon' => 'fa-shopping-bag', 'children' => array(
                    array('name' => 'soft', 'text' => '软件管理', 'url' => 'Soft/index'),
                    array('name' => 'soft-category', 'text' => '软件类别', 'url' => 'SoftCategory/index'),
                    array('name' => 'recycle', 'text' => '回收站', 'url' => 'SoftRecycle/index'),
                )),
            array('name' => 'content', 'text' => '内容', 'icon' => 'fa-book', 'children' => array(
                    array('name' => 'article', 'text' => '文章管理', 'url' => 'Article/index'),
                    array('name' => 'article-category', 'text' => '文章类别', 'url' => 'ArticleCategory/index'),
                    array('name' => 'advert', 'text' => '广告管理', 'url' => 'Advert/index'),
                    array('name' => 'navigation', 'text' => '导航菜单', 'url' => 'WebsiteMenu/index'),
                    array('name' => 'columns', 'text' => '栏目管理', 'url' => 'Channel/index'),
                    array('name' => 'pages', 'text' => '单页管理', 'url' => 'Pages/index'),
                    array('name' => 'pages-category', 'text' => '单页类别管理', 'url' => 'PageCategory/index'),
                    array('name' => 'files', 'text' => '文件管理', 'url' => 'Files/index'),
                    array('name' => 'file-category', 'text' => '文件类别管理', 'url' => 'FileCategory/index'),
                    array('name' => 'picture', 'text' => '图片管理', 'url' => 'Pictures/index'),
                    array('name' => 'picture-category', 'text' => '图片类别管理', 'url' => 'PictureCategory/index'),
                    array('name' => 'reviews', 'text' => '评论管理', 'url' => 'ContentReply/index'),
                    array('name' => 'recycle', 'text' => '回收站', 'url' => 'ContentRecycle/index'),
                )),
            array('name' => 'report', 'text' => '报表', 'icon' => 'fa-pie-chart'),
            array('name' => 'promotion', 'text' => '推广', 'icon' => 'fa-share-alt-square', 'children' => array(
                    array('name' => 'statistics', 'text' => '站点统计', 'url' => 'Statistics/index'),
                    array('name' => 'links', 'text' => '友情链接', 'url' => 'Links/index'),
                    array('name' => 'referral-link', 'text' => '推广链接', 'url' => 'ReferralLink/index'),
                )),
            array('name' => 'system', 'text' => '系统', 'icon' => 'fa-gear', 'children' => array(
                    array('name' => 'feedback', 'text' => '用户反馈', 'url' => 'Feedback/index'),
                    array('name' => 'settings', 'text' => '网站设置', 'url' => 'Settings/base'),
                    array('name' => 'backup', 'text' => '备份还原', 'url' => 'Backup/index'),
                    array('name' => 'oauth', 'text' => '开放登录', 'url' => 'Oauth/edit'),
                    array('name' => 'email', 'text' => '邮件设置', 'url' => 'Smtp/index'),
                    array('name' => 'wechat', 'text' => '微信设置', 'url' => 'system/wechat'),
                    array('name' => 'sensitive-words', 'text' => '敏感词设置', 'url' => 'SensitiveWords/content'),
                )),
            array('name' => 'security', 'text' => '安全', 'icon' => 'fa-shield', 'children' => array(
                    array('name' => 'security-settings', 'text' => '安全设置', 'url' => 'security/index'),
                    array('name' => 'filter', 'text' => '过滤设置', 'url' => 'FilterSetting/edit'),
                    array('name' => 'blacklist', 'text' => '黑名单管理', 'url' => 'Blacklist/index'),
                    array('name' => 'captcha', 'text' => '验证码管理', 'url' => 'CaptchaSetting/edit'),
                    array('name' => 'upload-settings', 'text' => '附件上传设置', 'url' => 'UploadSetting/edit'),
                    array('name' => 'log', 'text' => '日志记录', 'url' => 'LoginLog/index'),
                    array('name' => 'file-check', 'text' => '文件校验', 'url' => 'security/filecheck'),
                )),
        );
        return $data;
    }

    public static function getMenus2() {
        $data = array(
            array('name' => 'member', 'text' => '会员', 'icon' => 'fa-user', 'children' => array(
                    array('name' => 'index', 'text' => '网站会员', 'url' => 'member/index'),
                    array('name' => 'wechat-user', 'text' => '微信会员', 'url' => 'member/wechatuser'),
                    array('name' => 'group', 'text' => '会员分组', 'url' => 'MemberGroup/index'),
                    array('name' => 'level', 'text' => '会员等级', 'url' => 'MemberLevel/index'),
                    array('name' => 'points', 'text' => '会员积分', 'url' => 'MemberIntegral/edit'),
                    array('name' => 'settings', 'text' => '会员设置', 'url' => 'MemberSettings/edit'),
                )),
            array('name' => 'admin', 'text' => '管理员', 'icon' => 'fa-user-secret', 'children' => array(
                    array('name' => 'index', 'text' => '管理员', 'url' => 'admin/index'),
                    array('name' => 'group', 'text' => '角色管理', 'url' => 'Role/index'),
                    array('name' => 'department', 'text' => '部门管理', 'url' => 'Department/index'),
                )),
            array('name' => 'content', 'text' => '内容', 'icon' => 'fa-book', 'children' => array(
                    array('name' => 'article', 'text' => '文章管理', 'url' => 'Article/index'),
                    array('name' => 'article-category', 'text' => '文章类别', 'url' => 'ArticleCategory/index'),
                    array('name' => 'advert', 'text' => '广告管理', 'url' => 'Advert/index'),
                    array('name' => 'navigation', 'text' => '导航菜单', 'url' => 'WebsiteMenu/index'),
                    array('name' => 'columns', 'text' => '栏目管理', 'url' => 'Channel/index'),
                    array('name' => 'pages', 'text' => '单页管理', 'url' => 'Pages/index'),
                    array('name' => 'pages-category', 'text' => '单页类别管理', 'url' => 'PageCategory/index'),
                    array('name' => 'files', 'text' => '文件管理', 'url' => 'Files/index'),
                    array('name' => 'file-category', 'text' => '文件类别管理', 'url' => 'FileCategory/index'),
                    array('name' => 'picture', 'text' => '图片管理', 'url' => 'Pictures/index'),
                    array('name' => 'picture-category', 'text' => '图片类别管理', 'url' => 'PictureCategory/index'),
                    array('name' => 'reviews', 'text' => '评论管理', 'url' => 'ContentReply/index'),
                    array('name' => 'recycle', 'text' => '回收站', 'url' => 'ContentRecycle/index'),
                )),
            array('name' => 'mall', 'text' => '商城', 'icon' => 'fa-shopping-bag', 'children' => array(
                    array('name' => 'order', 'text' => '订单管理', 'url' => 'Order/index'),
                    array('name' => 'product', 'text' => '商品管理', 'url' => 'ProductGoods/index'),
                    array('name' => 'product-category', 'text' => '商品分类', 'url' => 'ProductCategory/index'),
                    array('name' => 'promotion', 'text' => '促销活动', 'url' => 'ProductPromotion/index'),
                    array('name' => 'brand', 'text' => '品牌管理', 'url' => 'ProductBrand/index'),
                    array('name' => 'specification', 'text' => '规格管理', 'url' => 'ProductSpecification/index'),
                    array('name' => 'invoicing', 'text' => '商品进销存', 'url' => 'ProductInvoicing/index'),
                    array('name' => 'reviews', 'text' => '评论管理', 'url' => 'ProductReply/index'),
                    array('name' => 'settings', 'text' => '商城设置', 'url' => 'MallSettings/edit'),
                )),
            array('name' => 'report', 'text' => '报表', 'icon' => 'fa-pie-chart'),
            array('name' => 'promotion', 'text' => '推广', 'icon' => 'fa-share-alt-square', 'children' => array(
                    array('name' => 'statistics', 'text' => '站点统计', 'url' => 'Statistics/index'),
                    array('name' => 'links', 'text' => '友情链接', 'url' => 'Links/index'),
                    array('name' => 'referral-link', 'text' => '推广链接', 'url' => 'ReferralLink/index'),
                )),
            array('name' => 'system', 'text' => '系统', 'icon' => 'fa-gear', 'children' => array(
                    array('name' => 'feedback', 'text' => '用户反馈', 'url' => 'Feedback/index'),
                    array('name' => 'settings', 'text' => '网站设置', 'url' => 'Settings/base'),
                    array('name' => 'backup', 'text' => '备份还原', 'url' => 'Backup/index'),
                    array('name' => 'oauth', 'text' => '开放登录', 'url' => 'Oauth/edit'),
                    array('name' => 'email', 'text' => '邮件设置', 'url' => 'Smtp/index'),
                    array('name' => 'wechat', 'text' => '微信设置', 'url' => 'system/wechat'),
                    array('name' => 'sensitive-words', 'text' => '敏感词设置', 'url' => 'SensitiveWords/content'),
                )),
            array('name' => 'security', 'text' => '安全', 'icon' => 'fa-shield', 'children' => array(
                    array('name' => 'security-settings', 'text' => '安全设置', 'url' => 'security/index'),
                    array('name' => 'filter', 'text' => '过滤设置', 'url' => 'FilterSetting/edit'),
                    array('name' => 'blacklist', 'text' => '黑名单管理', 'url' => 'Blacklist/index'),
                    array('name' => 'captcha', 'text' => '验证码管理', 'url' => 'CaptchaSetting/edit'),
                    array('name' => 'upload-settings', 'text' => '附件上传设置', 'url' => 'UploadSetting/edit'),
                    array('name' => 'log', 'text' => '日志记录', 'url' => 'LoginLog/index'),
                    array('name' => 'file-check', 'text' => '文件校验', 'url' => 'security/filecheck'),
                )),
            array('name' => 'ui', 'text' => '界面', 'icon' => 'fa-laptop', 'children' => array(
                    array('name' => 'theme', 'text' => '主题风格', 'url' => 'ui/theme'),
                    array('name' => 'skin', 'text' => '外观管理', 'url' => 'CustomTheme/edit'),
                    array('name' => 'layout', 'text' => '布局管理', 'url' => 'ui/layout'),
                    array('name' => 'design', 'text' => '可视化设计', 'url' => 'ui/design'),
                    array('name' => 'settings', 'text' => '内容设置', 'url' => 'ui/settings'),
                    array('name' => 'plug-in', 'text' => '插件管理', 'url' => 'ui/plugin'),
                )),
        );
        return $data;
    }

    // 2018-4-16
    public function reset_menus() {
        $id=0;
        $i=$i2=$i3=0;
        echo '<textarea cols="120" rows="60">';
        echo 'return [',PHP_EOL;
        $menus = \app\xwam\model\MenuModel::getMenus();
        foreach ($menus as $vo1) {
            $i++;
            echo "\t",'/**/', PHP_EOL;
            $id1='1'.substr('00'.$i,-2);
            echo "\t","'{$id1}200300' => ['id' => '{$id1}200300', 'text' => '{$vo1['text']}', 'url' => '{$vo1['url']}', 'icon' => '{$vo1['icon']}', 'children' => [",PHP_EOL;
            $i2=0;
            foreach ($vo1['children'] as $vo2) {
                $i2++;
                $id2="{$id1}2".substr('00'.$i2,-2);
                echo "\t\t","'{$id2}300' => ['id' => '{$id2}300', 'text' => '{$vo2['text']}', 'url' => '{$vo2['url']}', 'icon' => '{$vo2['icon']}', 'children' => [", PHP_EOL;
                $i3=0;
                foreach ($vo2['children'] as $vo3) {
                    $i3++;
                $id3="{$id2}3".substr('00'.$i3,-2);
                    echo "\t\t\t","'{$id3}' => ['id' => '{$id3}', 'text' => '{$vo3['text']}', 'url' => '{$vo3['url']}', 'icon' => '{$vo3['icon']}'],", PHP_EOL;
                }
                echo "\t\t",']],', PHP_EOL;
            }
            echo "\t",']],', PHP_EOL;
        }
        echo '];';
        echo '</textarea>';
    }

}
